package com.example.demospringboot.batch;

import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobExecutionListener;

public class MyJobListener implements JobExecutionListener{

	@Override
	public void beforeJob(JobExecution jobExecution) {
		System.out.println("开始执行");
	}

	@Override
	public void afterJob(JobExecution jobExecution) {
		if(jobExecution.getStatus() == BatchStatus.COMPLETED) {
			System.out.println("执行成功并且结束");
		}else if(jobExecution.getStatus() == BatchStatus.FAILED) {
			System.out.println("执行失败并且结束");
		}
	}

}
